import { ApiProperty, PartialType } from '@nestjs/swagger';
import { Decorator_DtoIsNumber_Base } from '@/common/decorators/dtoIsNumber';
import {
  IConstant_Enum_Type_Imgd_Enum_TypeKey,
  Constant_Enum_Enum_Imgd_Enum_TypeKey,
} from '@/common/constants/enum';
import { IsNotEmpty, IsOptional, IsString } from 'class-validator';

export class Imgd_Create_Dto {
  @IsString()
  @IsNotEmpty()
  @ApiProperty({ description: '图片路径' })
  imgUrl: string;

  @IsString()
  @IsOptional()
  @ApiProperty({ description: '分组键', enum: Constant_Enum_Enum_Imgd_Enum_TypeKey })
  typeKey: IConstant_Enum_Type_Imgd_Enum_TypeKey;

  @Decorator_DtoIsNumber_Base()
  @IsOptional()
  @ApiProperty({ default: 0, description: '排序' })
  order?: number;

  @IsString()
  @IsOptional()
  @ApiProperty({ description: '链接' })
  linkUrl?: string;

  @IsString()
  @IsOptional()
  @ApiProperty({ description: '描述' })
  describeImg?: string;
}

export class Imgd_Find_Dto {
  @Decorator_DtoIsNumber_Base()
  @IsOptional()
  size?: number;

  @Decorator_DtoIsNumber_Base()
  @IsOptional()
  page?: number;

  @IsString()
  @IsOptional()
  @ApiProperty({ description: '分组键', enum: Constant_Enum_Enum_Imgd_Enum_TypeKey })
  typeKey?: IConstant_Enum_Type_Imgd_Enum_TypeKey;
}
export class Imgd_Update_Dto extends PartialType(Imgd_Create_Dto) {
  @Decorator_DtoIsNumber_Base()
  @IsNotEmpty()
  id: number;
}

export class Imgd_FindAll_Dto {
  @IsString()
  @IsNotEmpty()
  @ApiProperty({ description: '分组键', enum: Constant_Enum_Enum_Imgd_Enum_TypeKey })
  typeKey: IConstant_Enum_Type_Imgd_Enum_TypeKey;
}

export class Imgd_Enum_TypeKeys_Dto {
  @IsString()
  @IsNotEmpty()
  @ApiProperty({ description: '分组键数组', example: 'allActive,allReActive' })
  typeKeys: string;
}
